version: "3"
services:
<% for (var i=0; i<nodes.length; i++) { %>
    <%= nodes[i].name %>:
        image: <%= dockerImage %>
        container_name: <%= nodes[i].name %>
        tty: true
        restart: always<% if (i === 0) { %>
        ports:
            - 8545:8545
            - 8546:8546
            - 26656:26656<% } %>
        command: "exrpd start --keyring-backend file --pruning=nothing --evm.tracer=json --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable --json-rpc.address 0.0.0.0:8545 --json-rpc.ws-address 0.0.0.0:8546"
        volumes:
            - ./<%= nodes[i].name %>:/root/.exrpd
<% } %>
<% if (enableExplorer) {%>
    db:
        image: postgres:14
        restart: always
        container_name: "postgres"
        environment:
            POSTGRES_PASSWORD: ""
            POSTGRES_USER: "postgres"
            POSTGRES_HOST_AUTH_METHOD: "trust"
        ports:
            - 7432:5432

    blockscout:
        depends_on:
            - db
        image: peersyst/xrp-evm-explorer:latest
        restart: always
        container_name: "explorer"
        links:
            - db:database
        command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
        extra_hosts:
            - "host.docker.internal:host-gateway"
        env_file:
            - ./explorer.env
        ports:
            - 80:4000

    smart-contract-verifier:
        image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
        restart: always
        container_name: 'smart-contract-verifier'
        env_file:
            - ./smart-contract-verifier.env
        ports:
            - 8043:8043
<% }%>
<% for (var i=0; i<witnesses.length; i++) { %>
    bridge-witness-<%= i %>:
        image: peersyst/xrp-evm-bridge-witness-go:latest
        container_name: bridge-witness-<%= i %>
        restart: always
        volumes:
            - ./witness-<%= i %>-config.yml:/app/configs/config.yml
        env_file:
            - ./witness-<%= i %>.env
<% }%>
